package com.restaurant.application.indexes.signinlist.mysql;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.UID;

import java.util.List;

public class SignInListCriteria implements PickableBean {

    public static final String FN_RECORDID = "recordId";
    public static final String FN_SIGNINUIDEQUALS = "signInUidEquals";
    public static final String FN_SIGNINUIDNOTEQUALS = "signInUidNotEquals";
    public static final String FN_SIGNTIMEUPPER = "signTimeUpper";
    public static final String FN_SIGNTIMELOWER = "signTimeLower";
    public static final String FN_SIGNTIMEEQUALS = "signTimeEquals";
    public static final String FN_SIGNTIMENOTEQUALS = "signTimeNotEquals";
    public static final String FN_CUSTOMERUIDEQUALS = "customerUidEquals";
    public static final String FN_CUSTOMERUIDNOTEQUALS = "customerUidNotEquals";
    public static final String FN_CUSTOMERNAMELIKE = "customerNameLike";
    public static final String FN_CUSTOMERNAMEEQUALS = "customerNameEquals";
    public static final String FN_CUSTOMERNAMENOTEQUALS = "customerNameNotEquals";
    public static final String FN_REALNAMELIKE = "realNameLike";
    public static final String FN_REALNAMEEQUALS = "realNameEquals";
    public static final String FN_REALNAMENOTEQUALS = "realNameNotEquals";

    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_RECORDID,
             FN_SIGNINUIDEQUALS,
             FN_SIGNINUIDNOTEQUALS,
             FN_SIGNTIMEUPPER,
             FN_SIGNTIMELOWER,
             FN_SIGNTIMEEQUALS,
             FN_SIGNTIMENOTEQUALS,
             FN_CUSTOMERUIDEQUALS,
             FN_CUSTOMERUIDNOTEQUALS,
             FN_CUSTOMERNAMELIKE,
             FN_CUSTOMERNAMEEQUALS,
             FN_CUSTOMERNAMENOTEQUALS,
             FN_REALNAMELIKE,
             FN_REALNAMEEQUALS,
             FN_REALNAMENOTEQUALS);

    private Long recordId;
    private UID signInUidEquals;
    private UID signInUidNotEquals;
    private Long signTimeUpper;
    private Long signTimeLower;
    private Long signTimeEquals;
    private Long signTimeNotEquals;
    private UID customerUidEquals;
    private UID customerUidNotEquals;
    private String customerNameLike;
    private String customerNameEquals;
    private String customerNameNotEquals;
    private String realNameLike;
    private String realNameEquals;
    private String realNameNotEquals;

    public SignInListCriteria(Long recordId, UID signInUidEquals, UID signInUidNotEquals, Long signTimeUpper, Long signTimeLower, Long signTimeEquals, Long signTimeNotEquals, UID customerUidEquals, UID customerUidNotEquals, String customerNameLike, String customerNameEquals, String customerNameNotEquals, String realNameLike, String realNameEquals, String realNameNotEquals) {
        setRecordId(recordId);
        setSignInUidEquals(signInUidEquals);
        setSignInUidNotEquals(signInUidNotEquals);
        setSignTimeUpper(signTimeUpper);
        setSignTimeLower(signTimeLower);
        setSignTimeEquals(signTimeEquals);
        setSignTimeNotEquals(signTimeNotEquals);
        setCustomerUidEquals(customerUidEquals);
        setCustomerUidNotEquals(customerUidNotEquals);
        setCustomerNameLike(customerNameLike);
        setCustomerNameEquals(customerNameEquals);
        setCustomerNameNotEquals(customerNameNotEquals);
        setRealNameLike(realNameLike);
        setRealNameEquals(realNameEquals);
        setRealNameNotEquals(realNameNotEquals);
    }

    public SignInListCriteria() {
    }

    public SignInListCriteria duplicate() {
        SignInListCriteria result = new SignInListCriteria();
        result.recordId = this.recordId;
        result.signInUidEquals = this.signInUidEquals;
        result.signInUidNotEquals = this.signInUidNotEquals;
        result.signTimeUpper = this.signTimeUpper;
        result.signTimeLower = this.signTimeLower;
        result.signTimeEquals = this.signTimeEquals;
        result.signTimeNotEquals = this.signTimeNotEquals;
        result.customerUidEquals = this.customerUidEquals;
        result.customerUidNotEquals = this.customerUidNotEquals;
        result.customerNameLike = this.customerNameLike;
        result.customerNameEquals = this.customerNameEquals;
        result.customerNameNotEquals = this.customerNameNotEquals;
        result.realNameLike = this.realNameLike;
        result.realNameEquals = this.realNameEquals;
        result.realNameNotEquals = this.realNameNotEquals;
        return result;
    }

    @Override
    public String toString() {
        return Convert.toJson(this);
    }

    public Long getRecordId() {
        return recordId;
    }

    public void  setRecordId(Long value) {
        this.recordId = value;
    }

    public SignInListCriteria withRecordId(Long value) {
        setRecordId(value);
        return this;
    }

    public SignInListCriteria withRecordId(Long value, Long defaultValue) {
        setRecordId(value == null ? defaultValue : value);
        return this;
    }

    public UID getSignInUidEquals() {
        return signInUidEquals;
    }

    public void  setSignInUidEquals(UID value) {
        this.signInUidEquals = value;
    }

    public SignInListCriteria withSignInUidEquals(UID value) {
        setSignInUidEquals(value);
        return this;
    }

    public SignInListCriteria withSignInUidEquals(UID value, UID defaultValue) {
        setSignInUidEquals(value == null ? defaultValue : value);
        return this;
    }

    public UID getSignInUidNotEquals() {
        return signInUidNotEquals;
    }

    public void  setSignInUidNotEquals(UID value) {
        this.signInUidNotEquals = value;
    }

    public SignInListCriteria withSignInUidNotEquals(UID value) {
        setSignInUidNotEquals(value);
        return this;
    }

    public SignInListCriteria withSignInUidNotEquals(UID value, UID defaultValue) {
        setSignInUidNotEquals(value == null ? defaultValue : value);
        return this;
    }

    public Long getSignTimeUpper() {
        return signTimeUpper;
    }

    public void  setSignTimeUpper(Long value) {
        this.signTimeUpper = value;
    }

    public SignInListCriteria withSignTimeUpper(Long value) {
        setSignTimeUpper(value);
        return this;
    }

    public SignInListCriteria withSignTimeUpper(Long value, Long defaultValue) {
        setSignTimeUpper(value == null ? defaultValue : value);
        return this;
    }

    public Long getSignTimeLower() {
        return signTimeLower;
    }

    public void  setSignTimeLower(Long value) {
        this.signTimeLower = value;
    }

    public SignInListCriteria withSignTimeLower(Long value) {
        setSignTimeLower(value);
        return this;
    }

    public SignInListCriteria withSignTimeLower(Long value, Long defaultValue) {
        setSignTimeLower(value == null ? defaultValue : value);
        return this;
    }

    public Long getSignTimeEquals() {
        return signTimeEquals;
    }

    public void  setSignTimeEquals(Long value) {
        this.signTimeEquals = value;
    }

    public SignInListCriteria withSignTimeEquals(Long value) {
        setSignTimeEquals(value);
        return this;
    }

    public SignInListCriteria withSignTimeEquals(Long value, Long defaultValue) {
        setSignTimeEquals(value == null ? defaultValue : value);
        return this;
    }

    public Long getSignTimeNotEquals() {
        return signTimeNotEquals;
    }

    public void  setSignTimeNotEquals(Long value) {
        this.signTimeNotEquals = value;
    }

    public SignInListCriteria withSignTimeNotEquals(Long value) {
        setSignTimeNotEquals(value);
        return this;
    }

    public SignInListCriteria withSignTimeNotEquals(Long value, Long defaultValue) {
        setSignTimeNotEquals(value == null ? defaultValue : value);
        return this;
    }

    public UID getCustomerUidEquals() {
        return customerUidEquals;
    }

    public void  setCustomerUidEquals(UID value) {
        this.customerUidEquals = value;
    }

    public SignInListCriteria withCustomerUidEquals(UID value) {
        setCustomerUidEquals(value);
        return this;
    }

    public SignInListCriteria withCustomerUidEquals(UID value, UID defaultValue) {
        setCustomerUidEquals(value == null ? defaultValue : value);
        return this;
    }

    public UID getCustomerUidNotEquals() {
        return customerUidNotEquals;
    }

    public void  setCustomerUidNotEquals(UID value) {
        this.customerUidNotEquals = value;
    }

    public SignInListCriteria withCustomerUidNotEquals(UID value) {
        setCustomerUidNotEquals(value);
        return this;
    }

    public SignInListCriteria withCustomerUidNotEquals(UID value, UID defaultValue) {
        setCustomerUidNotEquals(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerNameLike() {
        return customerNameLike;
    }

    public void  setCustomerNameLike(String value) {
        this.customerNameLike = value;
    }

    public SignInListCriteria withCustomerNameLike(String value) {
        setCustomerNameLike(value);
        return this;
    }

    public SignInListCriteria withCustomerNameLike(String value, String defaultValue) {
        setCustomerNameLike(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerNameEquals() {
        return customerNameEquals;
    }

    public void  setCustomerNameEquals(String value) {
        this.customerNameEquals = value;
    }

    public SignInListCriteria withCustomerNameEquals(String value) {
        setCustomerNameEquals(value);
        return this;
    }

    public SignInListCriteria withCustomerNameEquals(String value, String defaultValue) {
        setCustomerNameEquals(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerNameNotEquals() {
        return customerNameNotEquals;
    }

    public void  setCustomerNameNotEquals(String value) {
        this.customerNameNotEquals = value;
    }

    public SignInListCriteria withCustomerNameNotEquals(String value) {
        setCustomerNameNotEquals(value);
        return this;
    }

    public SignInListCriteria withCustomerNameNotEquals(String value, String defaultValue) {
        setCustomerNameNotEquals(value == null ? defaultValue : value);
        return this;
    }

    public String getRealNameLike() {
        return realNameLike;
    }

    public void  setRealNameLike(String value) {
        this.realNameLike = value;
    }

    public SignInListCriteria withRealNameLike(String value) {
        setRealNameLike(value);
        return this;
    }

    public SignInListCriteria withRealNameLike(String value, String defaultValue) {
        setRealNameLike(value == null ? defaultValue : value);
        return this;
    }

    public String getRealNameEquals() {
        return realNameEquals;
    }

    public void  setRealNameEquals(String value) {
        this.realNameEquals = value;
    }

    public SignInListCriteria withRealNameEquals(String value) {
        setRealNameEquals(value);
        return this;
    }

    public SignInListCriteria withRealNameEquals(String value, String defaultValue) {
        setRealNameEquals(value == null ? defaultValue : value);
        return this;
    }

    public String getRealNameNotEquals() {
        return realNameNotEquals;
    }

    public void  setRealNameNotEquals(String value) {
        this.realNameNotEquals = value;
    }

    public SignInListCriteria withRealNameNotEquals(String value) {
        setRealNameNotEquals(value);
        return this;
    }

    public SignInListCriteria withRealNameNotEquals(String value, String defaultValue) {
        setRealNameNotEquals(value == null ? defaultValue : value);
        return this;
    }

    public Object getValueOf(String name) {
        switch(name) {
        case "recordId": return getRecordId();
        case "signInUidEquals": return getSignInUidEquals();
        case "signInUidNotEquals": return getSignInUidNotEquals();
        case "signTimeUpper": return getSignTimeUpper();
        case "signTimeLower": return getSignTimeLower();
        case "signTimeEquals": return getSignTimeEquals();
        case "signTimeNotEquals": return getSignTimeNotEquals();
        case "customerUidEquals": return getCustomerUidEquals();
        case "customerUidNotEquals": return getCustomerUidNotEquals();
        case "customerNameLike": return getCustomerNameLike();
        case "customerNameEquals": return getCustomerNameEquals();
        case "customerNameNotEquals": return getCustomerNameNotEquals();
        case "realNameLike": return getRealNameLike();
        case "realNameEquals": return getRealNameEquals();
        case "realNameNotEquals": return getRealNameNotEquals();
        }
        return null;
    }

    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }

    @Override
    public int hashCode() {
        return signature().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if(!(o instanceof SignInListCriteria)) return false;
        return signature().equals(((SignInListCriteria)o).signature());
    }

    public String signature() {
        throw new RuntimeException("Bean SignInListCriteria has no signature defined, no hash code or equals possible.");
    }
}
